package cn.edu.zhku.dto;

import cn.edu.zhku.pojo.Task;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
public class TaskDto extends BaseDto {
    @ApiModelProperty("任务标题")
    private String title;
    @ApiModelProperty("地区")
    private String area;
    @ApiModelProperty("创建时间")
    private Date createTime;
    @ApiModelProperty("过期时间")
    private Date expireTime;
    @ApiModelProperty("备注/描述")
    private String remark;

    public Task getTask() {
        Task task = new Task();
        task.setTaskId(this.taskId);
        task.setUserId(this.userId);
        if (this.title != null) task.setTitle(this.title.trim());
        if (this.area != null) task.setArea(this.area.trim());
        task.setCreateTime(this.createTime);
        task.setExpireTime(this.expireTime);
        if (this.remark != null) task.setRemark(this.remark.trim());
        return task;
    }

}
